package com.wx.business.course.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.xml.soap.Detail;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.eachonline.mapper.GenericMapper;
import com.eachonline.service.GenericServiceImpl;
import com.wx.business.course.IxbBusinessPictureService;
import com.wx.business.course.IxbCourseDetailService;
import com.wx.dao.mapper.IxbCourseDetailMapper;
import com.wx.model.IxbCourseDetail;
import com.wx.model.IxbCourseDetailExample;
@Service("ixbCourseDetailService")
public class IxbCourseDetailServiceImpl extends GenericServiceImpl<IxbCourseDetail, IxbCourseDetailExample, String> implements IxbCourseDetailService  {

	private static final  Logger logger =Logger.getLogger(IxbBusinessPictureService.class);

	@Resource
	private IxbCourseDetailMapper ixbCourseDetailMapper;
	
	@Override
	protected GenericMapper<IxbCourseDetail, IxbCourseDetailExample, String> getGenericMapper() {
		return ixbCourseDetailMapper;
	}

	@Override
	public List<Map<String, Object>> queryCourseBuyers(String courseId) {
		// TODO Auto-generated method stub
		return ixbCourseDetailMapper.queryCourseBuyers(courseId);
	}

	@Override
	public List<Map<String, Object>> selectMapsByPage(IxbCourseDetailExample ext) {
		// TODO Auto-generated method stub
		return ixbCourseDetailMapper.selectMapsByPage(ext);
	}

	@Override
	public Map<String, Object> queryCourseDetailById(String sid) {
		// TODO Auto-generated method stub
		return ixbCourseDetailMapper.queryCourseDetailById(sid);
	}

	@Override
	public List<IxbCourseDetail> selectIxbCourse(String isFinish) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Map<String, Object>> selectRecCourseList(String orderByField) {
		// TODO Auto-generated method stub
		return ixbCourseDetailMapper.selectRecCourseList(orderByField);
	}

	@Override
	public void updateCourseCollectNum(String courseId) {
		// TODO Auto-generated method stub
		IxbCourseDetail  detail =ixbCourseDetailMapper.selectByPrimaryKey(courseId);
		
		detail.setCollectNum(detail.getCollectNum()+1); 
		ixbCourseDetailMapper.updateByPrimaryKeySelective(detail);
	}
}
